﻿@using Models
@model List<News>
@if (ViewBag.i != null)
{
    int i = Convert.ToInt32(ViewBag.i);
   
   
   <div id="newsBorder">
    <div id="oneNews">
        <div id="newsName">
        <b>News title:</b> @Html.ActionLink(Model[i].Title.Substring(0, Model[i].Title.Length < 50 ? Model[i].Title.Length : 50), "Index", "Home", new { id = Model[i].Id }, null)
        </div>
        <div id="newsAuthor">
        @Html.ActionLink(Model[i].Author, "Index", "Users", new { id = Model[i].Author }, null)
        </div>
        <div id="newsText">
        <b>Short description</b><br />
        @{
                    @Model[i].Text.Substring(0, Model[i].Text.Length < 150 ? Model[i].Text.Length : 150);
                    
                 }...
        </div>
        <div id="newsRating">
        Rating: @Model[i].Rating
        </div>
       
         <div id="newsDate">
            @if (Model[i].UpdateDate != null)
            {

                                <span>Date of last update: @Model[i].UpdateDate.Value.GetDateTimeFormats()[15]</span>
            }
            else
            {
                if (Model[i].PublishDate != null)
                {
                                    <span>Date of publishing: @Model[i].PublishDate.Value.GetDateTimeFormats()[15] </span>
                }
            }
        </div>
        <div id="buttomMore">
        @Html.ActionLink("More", "Index", "Home", new { id = Model[i].Id }, null)
        </div>
    </div>
    </div>
    <div id="separator">
    </div>
}